﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Common.ExpressionHelper
{
    public static partial class ExpressionHelper
    {
        /// <summary>
        /// 逻辑与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp">源表达式</param>
        /// <param name="AndExp">拼接的表达式</param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> OrginExp, Expression<Func<T, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, bool>>(Expression.And(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp">源表达式</param>
        /// <param name="AndExp">拼接的表达式</param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> And<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, Expression<Func<T, T1, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, bool>>(Expression.And(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp">源表达式</param>
        /// <param name="AndExp">拼接的表达式</param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> And<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, Expression<Func<T, T1, T2, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, T2, bool>>(Expression.And(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp">源表达式</param>
        /// <param name="AndExp">拼接的表达式</param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> And<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, Expression<Func<T, T1, T2, T3, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, bool>>(Expression.And(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp">源表达式</param>
        /// <param name="AndExp">拼接的表达式</param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> And<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, Expression<Func<T, T1, T2, T3, T4, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, T4, bool>>(Expression.And(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径与方法(当表达式中某段表达式可以决定表达式的最终结果就放弃接下来的所有操作)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp">源表达式</param>
        /// <param name="AndExp">拼接的表达式</param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> AndAlso<T>(this Expression<Func<T, bool>> OrginExp, Expression<Func<T, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, bool>>(Expression.AndAlso(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径与方法(当表达式中某段表达式可以决定表达式的最终结果就放弃接下来的所有操作)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> AndAlso<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, Expression<Func<T, T1, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, bool>>(Expression.AndAlso(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径与方法(当表达式中某段表达式可以决定表达式的最终结果就放弃接下来的所有操作)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> AndAlso<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, Expression<Func<T, T1, T2, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, T2, bool>>(Expression.AndAlso(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径与方法(当表达式中某段表达式可以决定表达式的最终结果就放弃接下来的所有操作)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> AndAlso<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, Expression<Func<T, T1, T2, T3, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, bool>>(Expression.AndAlso(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径与方法(当表达式中某段表达式可以决定表达式的最终结果就放弃接下来的所有操作)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> AndAlso<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, Expression<Func<T, T1, T2, T3, T4, bool>> AndExp)
        {
            if (OrginExp == null)
            {
                return AndExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, T4, bool>>(Expression.AndAlso(OrginExp.Body, AndExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> OrginExp, Expression<Func<T, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, bool>>(Expression.Or(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> Or<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, Expression<Func<T, T1, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, bool>>(Expression.Or(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> Or<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, Expression<Func<T, T1, T2, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, T2, bool>>(Expression.Or(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> Or<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, Expression<Func<T, T1, T2, T3, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, bool>>(Expression.Or(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 逻辑或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> Or<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, Expression<Func<T, T1, T2, T3, T4, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, T4, bool>>(Expression.Or(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }


        /// <summary>
        /// 最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> OrElse<T>(this Expression<Func<T, bool>> OrginExp, Expression<Func<T, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, bool>>(Expression.OrElse(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> OrElse<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, Expression<Func<T, T1, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, bool>>(Expression.OrElse(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> OrElse<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, Expression<Func<T, T1, T2, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, T2, bool>>(Expression.OrElse(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> OrElse<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, Expression<Func<T, T1, T2, T3, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, bool>>(Expression.OrElse(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> OrElse<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, Expression<Func<T, T1, T2, T3, T4, bool>> OrExp)
        {
            if (OrginExp == null)
            {
                return OrExp;
            }
            return Expression.Lambda<Func<T, T1, T2, T3, T4, bool>>(Expression.OrElse(OrginExp.Body, OrExp.Body), OrginExp.Parameters);
        }
        /// <summary>
        /// 有条件的And拼接
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> AndIF<T>(this Expression<Func<T, bool>> OrginExp, bool AndIF, Expression<Func<T, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.And(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        public static Expression<Func<T, T1, bool>> AndIF<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.And(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        public static Expression<Func<T, T1, T2, bool>> AndIF<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.And(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        public static Expression<Func<T, T1, T2, T3, bool>> AndIF<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.And(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        public static Expression<Func<T, T1, T2, T3, T4, bool>> AndIF<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, T4, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.And(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> AndAlsoIF<T>(this Expression<Func<T, bool>> OrginExp, bool AndIF, Expression<Func<T, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.AndAlso(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> AndAlsoIF<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.AndAlso(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> AndAlsoIF<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.AndAlso(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> AndAlsoIF<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.AndAlso(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短与方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> AndAlsoIF<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, T4, bool>> AndExp)
        {
            if (AndIF)
            {
                return OrginExp.AndAlso(AndExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> OrIF<T>(this Expression<Func<T, bool>> OrginExp, bool AndIF, Expression<Func<T, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.Or(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> OrIF<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.Or(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> OrIF<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.Or(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> OrIF<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.Or(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> OrIF<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, T4, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.Or(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="OrExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, bool>> OrElseIF<T>(this Expression<Func<T, bool>> OrginExp, bool AndIF, Expression<Func<T, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.OrElse(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, bool>> OrElseIF<T, T1>(this Expression<Func<T, T1, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.OrElse(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, bool>> OrElseIF<T, T1, T2>(this Expression<Func<T, T1, T2, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.OrElse(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, bool>> OrElseIF<T, T1, T2, T3>(this Expression<Func<T, T1, T2, T3, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.OrElse(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
        /// <summary>
        /// 有条件的最短路径或方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <typeparam name="T3"></typeparam>
        /// <typeparam name="T4"></typeparam>
        /// <param name="OrginExp"></param>
        /// <param name="AndIF"></param>
        /// <param name="AndExp"></param>
        /// <returns></returns>
        public static Expression<Func<T, T1, T2, T3, T4, bool>> OrElseIF<T, T1, T2, T3, T4>(this Expression<Func<T, T1, T2, T3, T4, bool>> OrginExp, bool AndIF, Expression<Func<T, T1, T2, T3, T4, bool>> OrExp)
        {
            if (AndIF)
            {
                return OrginExp.OrElse(OrExp);
            }
            else
            {
                return OrginExp;
            }
        }
    }
}
